package com.xbk.platform;

import java.util.HashMap;

public class ChangeObject {

	private String id;
	private String tablename;
	private String column;
	private String columnkey;
	private String keyvalues;
	private String userid;
	private String runtime;
	private String runsql;
	private String rollupsql;
	private Object oldvalue;
	private Object nowvalue;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTablename() {
		return tablename;
	}

	public void setTablename(String tablename) {
		this.tablename = tablename;
	}

	public String getColumn() {
		return column;
	}

	public void setColumn(String column) {
		this.column = column;
	}

	public String getColumnkey() {
		return columnkey;
	}

	public void setColumnkey(String columnkey) {
		this.columnkey = columnkey;
	}

	public String getKeyvalues() {
		return keyvalues;
	}

	public void setKeyvalues(String keyvalues) {
		this.keyvalues = keyvalues;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getRuntime() {
		return runtime;
	}

	public void setRuntime(String runtime) {
		this.runtime = runtime;
	}

	public void setRollupsql(String rollupsql) {
		this.rollupsql = rollupsql;
	}

	public void setOldvalue(String oldvalue) {
		this.oldvalue = oldvalue;
	}

	public void setNowvalue(String nowvalue) {
		this.nowvalue = nowvalue;
	}

	public Object getOldvalue() {
		return oldvalue;
	}

	public void setOldvalue(Object oldvalue) {
		this.oldvalue = oldvalue;
	}

	public Object getNowvalue() {
		return nowvalue;
	}

	public void setNowvalue(Object nowvalue) {
		this.nowvalue = nowvalue;
	}

	public HashMap<String, Object> toMap() {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("ID", id);
		map.put("TABLENAME", tablename);
		map.put("COLUMNNAME", column);
		map.put("COLUMNKEY", columnkey);
		map.put("KEYVALUES", keyvalues);
		map.put("USERID", userid);
		map.put("RUNTIME", runtime);
		map.put("RUNSQL", runsql);
		map.put("ROLLUPSQL", rollupsql);
		map.put("OLDVALUE", oldvalue);
		map.put("NOWVALUE", nowvalue);
		return map;
	}
	
	public String getRollupSQL(String tableName2, String key, String kv) {
		String changeSQL = "UPDATE " + tableName2 + " SET " + this.column
				+ " = '" + this.oldvalue + "' WHERE " + key + "='" + kv + "'";
		return changeSQL;
	}
}
